package xyz.hujf.base.deamonThread;

/**
 * @author Hujf
 * @title: daemonthread
 * @date 2021-04-239:30
 * @description: 守护线程
 */
public class daemonthread {
    public static void main(String[] args) {
        Thread daemonThread = new Thread(()->{
            //线程死循环
            for(;;){
                System.out.println("123");
            }
        });

        //设置为守护线程
        daemonThread.setDaemon(false);

        daemonThread.start();
        System.out.println("main is over");
    }
}
